package atom.core3.hibernate.dao.impl;
/**
 * Title: 获取数据库系统时间的dao
 * Description:
 * Copyright: Copyright (c) 2010
 * @author 赵明才
 * @version 1.0
 */
import java.util.Date;

import atom.core0.util.DateUtil;


public class OracleDateDao extends BaseHibernateDao
{

	protected Class getEntityClass()
	{
		return null;
	}

	public Date getTime() throws Exception
	{
		String sql = "SELECT to_char(SYSDATE,'yyyymmddhh24miss') FROM DUAL";
		String datestring = (String) this.getUniqueResultBySql(sql);
		
		return DateUtil.getDate(datestring);
	}

	public String getDateStr()
	{
		String sql = "SELECT to_char(SYSDATE,'yyyymmdd')  FROM DUAL";
		return (String) this.getUniqueResultBySql(sql);
	}
	public String getTimeStr() throws Exception
	{
		String sql = "SELECT to_char(SYSDATE,'yyyymmddhh24miss') FROM DUAL";
		String datestring = (String) this.getUniqueResultBySql(sql);
		
		return datestring;
	}


	// 出错 Oracle可以获取到毫秒
	public Object getWorkDate22()
	{
		String sql = "SELECT systimestamp  FROM DUAL";
		return this.getUniqueResultBySql(sql);
	}

	// 竟然只有日期 无时间
	public Object getTime22()
	{
		String sql = "SELECT SYSDATE FROM DUAL";
		return this.getUniqueResultBySql(sql);
	}
	
}
